package com.worthtech.billportal.service.imp;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.worthtech.billportal.bean.CsPosMerAccount;
import com.worthtech.billportal.bean.CsPosMerAccountLs;
import com.worthtech.billportal.dao.PosBindAccountDao;
import com.worthtech.billportal.service.PosBinAccountService;

public class PosBindAccountServiceImp extends HibernateDaoSupport implements
		PosBinAccountService {
	
	private PosBindAccountDao accountDAO;

	
	
	
	public PosBindAccountDao getAccountDAO() {
		return accountDAO;
	}

	public void setAccountDAO(PosBindAccountDao accountDAO) {
		this.accountDAO = accountDAO;
	}

	public void addAccount(CsPosMerAccount account) {
		this.getAccountDAO().addAccount(account);
	}

	public String createLcHead(String LcHead) {
		return null;
	}

	public void delObj(CsPosMerAccount account) {
		this.getAccountDAO().delObj(account);
	}

	public CsPosMerAccountLs getByMerTrmcode(String tableName,
			String mercode, String trmcode,  String sql) {
		List<CsPosMerAccountLs> list = this.getAccountDAO().getByMerTrmcode(tableName, mercode, trmcode, sql);
		if(list!=null&&list.size()>0){
			return list.get(0);
		}
		return new CsPosMerAccountLs(); 
	}

	public String getCount(String tableName, String condition) {
		return this.getAccountDAO().getCount(tableName, condition);
	}

	public List getListByHQL(String tableName, int startPage, int perNo,
			String orderby) {
		return this.getAccountDAO().getListByHQL(tableName, startPage, perNo, orderby);
	}

	public void updateFlag(CsPosMerAccount account) {
		this.getAccountDAO().updateFlag(account);
	}

	public void addAccountLS(CsPosMerAccountLs account) {
			this.getAccountDAO().addAccountLS(account);
	}

	public void delObjLS(CsPosMerAccountLs account) {
		this.getAccountDAO().delObj(account);
	}

	public void updateFlagLS(CsPosMerAccountLs account) {
			this.getAccountDAO().updateFlagLS(account);
	}

	@SuppressWarnings("unchecked")
	public List<CsPosMerAccount> getByMerTrm(String tableName, String mercode,
			String trmcode, String sql) {
			List<CsPosMerAccount> list = this.getAccountDAO().getByMerTrmcode(tableName, mercode, trmcode, sql);
			
			return list; 
	}

}
